using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Keep.Const;
using Keep.Model;
using Keep.Service;
using Microsoft.AspNetCore.Mvc;
using Serilog;

namespace Keep.Controllers;

[ApiController]
[Route("api/[controller]/[action]")]
public class StatisticController : ControllerBase
{

    private readonly IFileService fileService;
    private readonly ILinkService linkService;
    private readonly IMusicListService musicListService;

    public StatisticController(ILinkService linkService, IFileService fileService, IMusicListService musicListService)
    {
        this.fileService = fileService;
        this.linkService = linkService;
        this.musicListService = musicListService;
    }

    [HttpPost(Name = "GetFileStatistic")]
    public async Task<ActionResult<ResultData>> GetFileStatistic()
    {
        Log.Warning("IN => ");
        List<Statistic> sys = await Task.Run(() => fileService.GetPathStatistic());
        Log.Warning("OUT => " + sys.Count);
        return Ok(new ResultData(Static.Enable, sys));
    }

}
